﻿/// ---------------------------------------------
/// 2012.7.20
/// 汪定新
///
/// ---------------------------------------------
//双击事件
function CustomDbClick() {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    var id = record.getData(const_entityID);
    var planName = record.getData("PlanName");
    var applyMan = record.getData("ApplyMan"); //拟定人
    var applyDate = record.getData("RegisterDate"); //拟定日期
    document.getElementById("dialog1_h").innerHTML = planName + "——查看招聘计划";
    document.getElementById("EditUIWindow").src = encodeURI("../Extend/AutoLoadForm.aspx?&id=" + id + "&entity=" + const_EditEntity + "&fun=view&applyMan=" + applyMan + "&applyDate=" + applyDate);
    SetDWH(550, 360, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}
//----------------------------------------------
//添加
var fnCustomAdd = function () {
    document.getElementById("dialog1_h").innerHTML = "新增招聘计划";
    document.getElementById("EditUIWindow").src = "../Extend/AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&fun=add";
    SetDWH(550, 360, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}
//编辑
var fnCustomEdit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    if (record.getData("status") != "待审批")//已审核过的不能再审核
    {
        alert("已经审批过了,不允许编辑!");
        return;
    }
    var planName = record.getData("PlanName");
    var applyMan = record.getData("ApplyMan"); //拟定人
    var applyDate = record.getData("RegisterDate"); //拟定日期
    document.getElementById("dialog1_h").innerHTML = planName + "——修改招聘计划";
    document.getElementById("EditUIWindow").src =encodeURI( "../Extend/AutoLoadForm.aspx?id=" + record.getData(const_entityID) + "&entity=" + const_EditEntity + "&fun=edit&applyMan=" + applyMan + "&applyDate=" + applyDate);
    SetDWH(550, 360, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}
//页面加载时
if (typeof ($) != "undefined") {
    $(document).ready(function () {

    });
}

//招聘计划审批
var fnZhaoPinAudit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    if (record.getData("status") != "待审批")//已审核过的不能再审批
    {
        alert("已经审批过了,不能重复审批!");
        return;
    }
    var id = record.getData(const_entityID);
    var planName = record.getData("PlanName");
    var applyMan = record.getData("ApplyMan"); //拟定人
    var applyDate = record.getData("RegisterDate"); //拟定日期
    document.getElementById("dialog1_h").innerHTML = planName + "——招聘计划审批";
    document.getElementById("EditUIWindow").src =encodeURI( "../Extend/AutoLoadForm.aspx?&id=" + id + "&entity=" + const_EditEntity + "&fun=audit&applyMan=" + applyMan + "&applyDate=" + applyDate);
    SetDWH(550, 420, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

//招聘计划明细管理
var fnZhaoPinPlanDetail = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    var id = record.getData(const_entityID);
    var planName = record.getData("PlanName");
    var pagetitle = planName + "——招聘计划明细";
    parent.addTabs(pagetitle, "../Extend/YUIDataTableList.aspx?r=" + Math.random() + "&entity=V_hrRecruitmentPlanDetail&condition=RecruitmentPlanID='" + id + "'&functionid=ADF38423-EAC8-4A60-A923-3FA78144AFC4&id=" + id);
    parent.NeedRefreshPage = this;
}